<template>
  <div class="carousel-container">
    <el-carousel :interval="5000" arrow="always">
      <el-carousel-item v-for="(item, index) in carouselItems" :key="index">
        <img :src="item.image" alt="轮播图" class="carousel-image" />
        <h3 class="carousel-title">{{ item.title }}</h3>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import img1 from '../assets/img1.png'
import img2 from '../assets/img2.png'
import img3 from '../assets/img3.png'
export default {
  name: 'FirstIndex',
  data() {
    return {
      carouselItems: [
        {
          image: img1,
          title: '欢迎来到租房信息分析系统'
        },
        {
          image: img2,
          title: '房源数据可视化展示'
        },
        {
          image: img3,
          title: '季度与区域趋势分析'
        }
      ]

    };
  }
};
</script>

<style scoped>
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.carousel-image {
  width: 100%;
  height: 600px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.carousel-image:hover {
  transform: scale(1.05);
}

.carousel-title {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 36px;
  font-weight: bold;
  text-align: center;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -60%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

</style>
